#!/usr/bin/perl -wc

package RFCMail::Common::Layered;

use strict;
no strict qw(refs);


sub import {
    my $package = shift;
    push @_, "${package}::base";
    my $parent;
    while (@_) {
	eval("require $package")
	    or die "$@";
	$parent = shift;
	push @{$package."::ISA"}, $parent;
	$package = $parent;
    }
}


sub new {
    my $class = shift;
    my $self = bless {@_}, $class;
    $self->init;
    return ($self);
}


sub DESTROY { $_[0]->cleanup }


1;
